<?php
namespace Home\Model;
use Think\Model;

class CheckInApplyModel extends Model
{
    /* 自动验证规则 */
    protected $_validate = array(
        array('name', 'require', '姓名必须', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('phone', 'require', '联系电话必须', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('email', 'require', '邮箱必须', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('id_card', 'require', '身份证必须', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
    );
    
    /* 自动完成规则 */
    protected $_auto = array(
    	array('create_time', "getCurTime", self::MODEL_INSERT, 'callback'),
        array('update_time', "getCurTime", self::MODEL_BOTH, 'callback'),
    );
    
    protected function getCurTime()
    {
        return date('Y-m-d H:i:s');
    }
}